pkgname=firmware-bananapi-bpi-m2-zero
pkgver=0
pkgrel=0
pkgdesc="Firmware for the Banana Pi M2 Zero"
url="https://github.com/BPI-SINOVOIP/BPI_WiFi_Firmware"
arch="armv7"
license="proprietary"
options="!check !strip !archcheck !tracedeps pmb:cross-native"
builddir="$srcdir/"

# Sources
_commit="a4846b40bc92b6d12e83143353455b2e79bf385e"
source="$pkgname-$pkgver.tar.gz::https://github.com/user0-07161/bananapi-m2-zero-wifi/archive/$_commit.tar.gz"

package() {
	_directories="ap6210 ap6212 brcm"
	for _i in $_directories; do
		_files=$(find bananapi-m2-zero-wifi-a4846b40bc92b6d12e83143353455b2e79bf385e/"$_i"/ -exec basename {} \;)
		for _file in $_files; do
			if [ "$_i" != "$file" ]; then
				install -D -m644 bananapi-m2-zero-wifi-a4846b40bc92b6d12e83143353455b2e79bf385e/"$_i"/"$_file" "$pkgdir"/lib/firmware/"$_i"/"$_file" || true # true is needed to ignore errors when install tries to install the root directory.
			fi
		done
	done
}

sha512sums="
dca8fa72fca189e15f0e5f23c03fc2660074937a330bd5a43def3b3ab9df30308ae1906f80cc42547464076f4f137acd04ba1719a79871a032c8cf35a9796395  firmware-bananapi-bpi-m2-zero-0.tar.gz
"
